// SetPixelSize.cpp : implementation file
//

#include "stdafx.h"
#include "yujinsrhost.h"
#include "SetPixelSize.h"
#include "VisionSys.h"
//#include "yujinsrhostview.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CSetPixelSize dialog


CSetPixelSize::CSetPixelSize(CWnd* pParent /*=NULL*/)
	: CDialog(CSetPixelSize::IDD, pParent)
{
	//{{AFX_DATA_INIT(CSetPixelSize)
		// NOTE: the ClassWizard will add member initialization here
	//}}AFX_DATA_INIT
}


void CSetPixelSize::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CSetPixelSize)
	DDX_Control(pDX, IDC_LBOUND_OPPONENT_SPIN, m_cLBoundOpponentSize);
	DDX_Control(pDX, IDC_UBOUND_OPPONENT_SPIN, m_cUBoundOpponentSize);
	DDX_Control(pDX, IDC_UBOUND_SMALL_ID_SPIN, m_cUBoundSmallIDSize);
	DDX_Control(pDX, IDC_UBOUND_BIG_TEAM_SPIN, m_cUBoundBigTeamSize);
	DDX_Control(pDX, IDC_LBOUND_SMALL_ID_SPIN, m_cLBoundSmallIDSize);
	DDX_Control(pDX, IDC_LBOUND_BIG_TEAM_SPIN, m_cLBoundBigTeamSize);
	DDX_Control(pDX, IDC_UBOUND_BALL_SIZE_SPIN, m_cUBoundBallSize);
	DDX_Control(pDX, IDC_LBOUND_BALL_SIZE_SPIN, m_cLBoundBallSize);// NOTE: the ClassWizard will add DDX and DDV calls here
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CSetPixelSize, CDialog)
	//{{AFX_MSG_MAP(CSetPixelSize)
	ON_BN_CLICKED(IDC_DEFAULT_SET_PIXEL_SIZE, OnDefaultSetPixelSize)
	ON_NOTIFY(UDN_DELTAPOS, IDC_LBOUND_BALL_SIZE_SPIN, OnDeltaposLboundBallSizeSpin)
	ON_NOTIFY(UDN_DELTAPOS, IDC_LBOUND_BIG_TEAM_SPIN, OnDeltaposLboundBigTeamSpin)
	ON_NOTIFY(UDN_DELTAPOS, IDC_LBOUND_OPPONENT_SPIN, OnDeltaposLboundOpponentSpin)
	ON_NOTIFY(UDN_DELTAPOS, IDC_LBOUND_SMALL_ID_SPIN, OnDeltaposLboundSmallIdSpin)
	ON_NOTIFY(UDN_DELTAPOS, IDC_UBOUND_BALL_SIZE_SPIN, OnDeltaposUboundBallSizeSpin)
	ON_NOTIFY(UDN_DELTAPOS, IDC_UBOUND_BIG_TEAM_SPIN, OnDeltaposUboundBigTeamSpin)
	ON_NOTIFY(UDN_DELTAPOS, IDC_UBOUND_OPPONENT_SPIN, OnDeltaposUboundOpponentSpin)
	ON_NOTIFY(UDN_DELTAPOS, IDC_UBOUND_SMALL_ID_SPIN, OnDeltaposUboundSmallIdSpin)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CSetPixelSize message handlers

void CSetPixelSize::OnDefaultSetPixelSize() 
{
	m_cLBoundBallSize.SetPos(DEF_LBOUND_BALL_SIZE);
	nLBoundBallSize = m_cLBoundBallSize.GetPos();
	m_cUBoundBallSize.SetPos(DEF_UBOUND_BALL_SIZE);
	nUBoundBallSize = m_cUBoundBallSize.GetPos();

	m_cLBoundBigTeamSize.SetPos(DEF_LBOUND_BIG_TEAM_SIZE);
	nLBoundBigTeamSize = m_cLBoundBigTeamSize.GetPos();
	m_cUBoundBigTeamSize.SetPos(DEF_UBOUND_BIG_TEAM_SIZE);
	nUBoundBigTeamSize = m_cUBoundBigTeamSize.GetPos();

	m_cLBoundSmallIDSize.SetPos(DEF_LBOUND_SMALL_ID_SIZE);
	nLBoundSmallIDSize = m_cLBoundSmallIDSize.GetPos();
	m_cUBoundSmallIDSize.SetPos(DEF_UBOUND_SMALL_ID_SIZE);
	nUBoundSmallIDSize = m_cUBoundSmallIDSize.GetPos();

	m_cLBoundOpponentSize.SetPos(DEF_LBOUND_OPPONENT_SIZE);
	nLBoundOpponentSize = m_cLBoundOpponentSize.GetPos();		
	m_cUBoundOpponentSize.SetPos(DEF_UBOUND_OPPONENT_SIZE);
	nUBoundOpponentSize = m_cUBoundOpponentSize.GetPos();
}

BOOL CSetPixelSize::OnInitDialog() 
{
	CDialog::OnInitDialog();
	
	// TODO: Add extra initialization here
	m_cLBoundBallSize.SetRange(MIN_LBOUND_BALL_SIZE, MAX_LBOUND_BALL_SIZE);
	m_cLBoundBallSize.SetPos(nLBoundBallSize);
	m_cUBoundBallSize.SetRange(MIN_UBOUND_BALL_SIZE, MAX_UBOUND_BALL_SIZE);
	m_cUBoundBallSize.SetPos(nUBoundBallSize);

	m_cLBoundBigTeamSize.SetRange(MIN_LBOUND_BIG_TEAM_SIZE, MAX_LBOUND_BIG_TEAM_SIZE);
	m_cLBoundBigTeamSize.SetPos(nLBoundBigTeamSize);
	m_cUBoundBigTeamSize.SetRange(MIN_UBOUND_BIG_TEAM_SIZE, MAX_UBOUND_BIG_TEAM_SIZE);
	m_cUBoundBigTeamSize.SetPos(nUBoundBigTeamSize);

	m_cLBoundSmallIDSize.SetRange(MIN_LBOUND_SMALL_ID_SIZE, MAX_LBOUND_SMALL_ID_SIZE);
	m_cLBoundSmallIDSize.SetPos(nLBoundSmallIDSize);
	m_cUBoundSmallIDSize.SetRange(MIN_UBOUND_SMALL_ID_SIZE, MAX_UBOUND_SMALL_ID_SIZE);
	m_cUBoundSmallIDSize.SetPos(nUBoundSmallIDSize);

	m_cLBoundOpponentSize.SetRange(MIN_LBOUND_OPPONENT_SIZE, MAX_LBOUND_OPPONENT_SIZE);
	m_cLBoundOpponentSize.SetPos(nLBoundOpponentSize);
	m_cUBoundOpponentSize.SetRange(MIN_UBOUND_OPPONENT_SIZE, MAX_UBOUND_OPPONENT_SIZE);
	m_cUBoundOpponentSize.SetPos(nUBoundOpponentSize);
	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}


void CSetPixelSize::OnDeltaposLboundBallSizeSpin(NMHDR* pNMHDR, LRESULT* pResult) 
{
	NM_UPDOWN* pNMUpDown = (NM_UPDOWN*)pNMHDR;
	// TODO: Add your control notification handler code here
	nLBoundBallSize = m_cLBoundBallSize.GetPos();
	
	*pResult = 0;
}

void CSetPixelSize::OnDeltaposLboundBigTeamSpin(NMHDR* pNMHDR, LRESULT* pResult) 
{
	NM_UPDOWN* pNMUpDown = (NM_UPDOWN*)pNMHDR;
	// TODO: Add your control notification handler code here
	nLBoundBigTeamSize = m_cLBoundBigTeamSize.GetPos();
	
	*pResult = 0;
}

void CSetPixelSize::OnDeltaposLboundSmallIdSpin(NMHDR* pNMHDR, LRESULT* pResult) 
{
	NM_UPDOWN* pNMUpDown = (NM_UPDOWN*)pNMHDR;
	// TODO: Add your control notification handler code here
	nLBoundSmallIDSize = m_cLBoundSmallIDSize.GetPos();
	
	*pResult = 0;
}



void CSetPixelSize::OnDeltaposUboundBallSizeSpin(NMHDR* pNMHDR, LRESULT* pResult) 
{
	NM_UPDOWN* pNMUpDown = (NM_UPDOWN*)pNMHDR;
	// TODO: Add your control notification handler code here
	nUBoundBallSize = m_cUBoundBallSize.GetPos();

	*pResult = 0;
}


void CSetPixelSize::OnDeltaposUboundBigTeamSpin(NMHDR* pNMHDR, LRESULT* pResult) 
{
	NM_UPDOWN* pNMUpDown = (NM_UPDOWN*)pNMHDR;
	// TODO: Add your control notification handler code here
	nUBoundBigTeamSize = m_cUBoundBigTeamSize.GetPos();
	
	*pResult = 0;
}

void CSetPixelSize::OnDeltaposUboundSmallIdSpin(NMHDR* pNMHDR, LRESULT* pResult) 
{
	NM_UPDOWN* pNMUpDown = (NM_UPDOWN*)pNMHDR;
	// TODO: Add your control notification handler code here
	nUBoundSmallIDSize = m_cUBoundSmallIDSize.GetPos();
	
	*pResult = 0;
}


void CSetPixelSize::OnDeltaposLboundOpponentSpin(NMHDR* pNMHDR, LRESULT* pResult) 
{
	NM_UPDOWN* pNMUpDown = (NM_UPDOWN*)pNMHDR;
	// TODO: Add your control notification handler code here
	nLBoundOpponentSize = m_cLBoundOpponentSize.GetPos();
	
	*pResult = 0;
}

void CSetPixelSize::OnDeltaposUboundOpponentSpin(NMHDR* pNMHDR, LRESULT* pResult) 
{
	NM_UPDOWN* pNMUpDown = (NM_UPDOWN*)pNMHDR;
	// TODO: Add your control notification handler code here
	nUBoundOpponentSize = m_cUBoundOpponentSize.GetPos();
	
	*pResult = 0;
}
